package com.pk.platform.business.charge.web;

import java.util.ArrayList;
import java.util.List;

import com.pk.platform.business.charge.service.IChargeIndexService;
import com.pk.platform.business.charge.vo.ChargeIndexVO;
import com.pk.platform.business.core.web.GenericAction;
import com.pk.platform.domain.charge.ChargeIndex;
import com.pk.platform.util.SelectOption;
import com.pk.platform.util.constant.Constant;

public class ChargeIndexAction extends GenericAction {

	private IChargeIndexService chargeIndexService;
	
	private ChargeIndex ci = new ChargeIndex();
	
	private ChargeIndexVO civo = new ChargeIndexVO();
	
	private List<SelectOption> indexTypeList = new ArrayList<SelectOption>();
	
	private boolean flag;
	
	public String chargeIndexManage()
	{
		indexTypeList = chargeIndexService.queryIndexTypeList();
		civo.getCi().setIsDel(Constant.N_INT);
		lp = chargeIndexService.queryChargeIndex(civo, pager);
		return SUCCESS;
	}
	
	public String toAddChargeIndex()
	{
		indexTypeList = chargeIndexService.queryIndexTypeList();
		return SUCCESS;
	}
	
	public String addChargeIndex()
	{
		ci.setIsDel(Constant.N_INT);
		message = chargeIndexService.addChargeIndex(ci);
		return SUCCESS;
	}
	
	public String toUpdateChargeIndex()
	{
		indexTypeList = chargeIndexService.queryIndexTypeList();
		ci = chargeIndexService.queryChargeIndexById(ci.getId());
		return SUCCESS;
	}
	
	public String updateChargeIndex()
	{
		flag = chargeIndexService.updateChargeIndex(ci);
		return SUCCESS;
	}
	
	public String delChargeIndex()
	{
		chargeIndexService.delChargeIndex(ci.getId());
		return SUCCESS;
	}

	
	
	
	
	public IChargeIndexService getChargeIndexService() {
		return chargeIndexService;
	}

	public void setChargeIndexService(IChargeIndexService chargeIndexService) {
		this.chargeIndexService = chargeIndexService;
	}

	public ChargeIndex getCi() {
		return ci;
	}

	public void setCi(ChargeIndex ci) {
		this.ci = ci;
	}

	public ChargeIndexVO getCivo() {
		return civo;
	}

	public void setCivo(ChargeIndexVO civo) {
		this.civo = civo;
	}

	public List<SelectOption> getIndexTypeList() {
		return indexTypeList;
	}

	public void setIndexTypeList(List<SelectOption> indexTypeList) {
		this.indexTypeList = indexTypeList;
	}

	public boolean isFlag() {
		return flag;
	}

	public void setFlag(boolean flag) {
		this.flag = flag;
	}
	
}
